<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
  <meta name="description" content="API docs for the generateThumbnail method from the PlayerLocalMediaSource class, for the Dart programming language.">
  <title>generateThumbnail method - PlayerLocalMediaSource class - media library - Dart API</title>


  
  <link rel="preconnect" href="https://fonts.gstatic.com">
  <link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" rel="stylesheet">
  
  <link rel="stylesheet" href="../../static-assets/github.css?v1">
  <link rel="stylesheet" href="../../static-assets/styles.css?v1">
  <link rel="icon" href="../../static-assets/favicon.png?v1">

  
</head>


<body data-base-href="../../" data-using-base-href="false" class="light-theme">

<div id="overlay-under-drawer"></div>

<header id="title">
  <span id="sidenav-left-toggle" class="material-symbols-outlined" role="button" tabindex="0">menu</span>
  <ol class="breadcrumbs gt-separated dark hidden-xs">
    <li><a href="../../index.html">yuuna</a></li>
    <li><a href="../../media/media-library.html">media</a></li>
    <li><a href="../../media/PlayerLocalMediaSource-class.html">PlayerLocalMediaSource</a></li>
    <li class="self-crumb">generateThumbnail method</li>
  </ol>
  <div class="self-name">generateThumbnail</div>
  <form class="search navbar-right" role="search">
    <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
  <div class="toggle" id="theme-button">
    <label for="theme">
      <input type="checkbox" id="theme" value="light-theme">
      <span id="dark-theme-button" class="material-symbols-outlined">
        brightness_4
      </span>
      <span id="light-theme-button" class="material-symbols-outlined">
        brightness_5
      </span>
    </label>
  </div>
</header>
<main>

  <div id="dartdoc-main-content" class="main-content">
      <div>
<h1><span class="kind-method">generateThumbnail</span> method 
</h1></div>

    <section class="multi-line-signature">
      

<span class="returntype"><a href="https://api.flutter.dev/flutter/dart-async/Future-class.html">Future</a><span class="signature">&lt;<wbr><span class="type-parameter">void</span>&gt;</span></span>
<span class="name ">generateThumbnail</span>(<wbr><ol class="parameter-list"><li><span class="parameter" id="generateThumbnail-param-inputPath"><span class="type-annotation"><a href="https://api.flutter.dev/flutter/dart-core/String-class.html">String</a></span> <span class="parameter-name">inputPath</span>, </span></li>
<li><span class="parameter" id="generateThumbnail-param-targetPath"><span class="type-annotation"><a href="https://api.flutter.dev/flutter/dart-core/String-class.html">String</a></span> <span class="parameter-name">targetPath</span></span></li>
</ol>)

      

    </section>
    
<section class="desc markdown">
  <p>Used to generate a thumbnail for a video file.</p>
</section>


    
<section class="summary source-code" id="source">
  <h2><span>Implementation</span></h2>
  <pre class="language-dart"><code class="language-dart">Future&lt;void&gt; generateThumbnail(String inputPath, String targetPath) async {
  String timestamp =
      JidoujishoTimeFormat.getFfmpegTimestamp(const Duration(seconds: 30));
  final FlutterFFmpeg _flutterFFmpeg = FlutterFFmpeg();

  String command =
      &#39;-ss $timestamp -y -i &quot;$inputPath&quot; -frames:v 1 -q:v 2 &quot;$targetPath&quot;&#39;;

  await _flutterFFmpeg.execute(command);
  String output = await FlutterFFmpegConfig().getLastCommandOutput();

  if (output.contains(&#39;Output file is empty, nothing was encoded&#39;)) {
    String timestamp =
        JidoujishoTimeFormat.getFfmpegTimestamp(const Duration(seconds: 1));

    String command =
        &#39;-ss $timestamp -y -i &quot;$inputPath&quot; -frames:v 1 -q:v 2 &quot;$targetPath&quot;&#39;;
    await _flutterFFmpeg.execute(command);
  }
}</code></pre>
</section>


  </div> <!-- /.main-content -->

  <div id="dartdoc-sidebar-left" class="sidebar sidebar-offcanvas-left">
    <header id="header-search-sidebar" class="hidden-l">
  <form class="search-sidebar" role="search">
    <input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
</header>

<ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
  <li><a href="../../index.html">yuuna</a></li>
  <li><a href="../../media/media-library.html">media</a></li>
  <li><a href="../../media/PlayerLocalMediaSource-class.html">PlayerLocalMediaSource</a></li>
  <li class="self-crumb">generateThumbnail method</li>
</ol>


    <h5>PlayerLocalMediaSource class</h5>
    <ol>



        <li class="section-title">
          <a href="../../media/PlayerLocalMediaSource-class.html#instance-properties">Properties</a>
        </li>
          <li><a href="../../media/PlayerLocalMediaSource/allowedExtensions.html">allowedExtensions</a></li>
          <li class="inherited"><a href="../../media/PlayerMediaSource/aspectRatio.html">aspectRatio</a></li>
          <li class="inherited"><a href="../../media/MediaSource/currentExtraData.html">currentExtraData</a></li>
          <li class="inherited"><a href="../../media/MediaSource/currentMediaItem.html">currentMediaItem</a></li>
          <li class="inherited"><a href="../../media/MediaSource/currentSentence.html">currentSentence</a></li>
          <li class="inherited"><a href="../../media/MediaSource/description.html">description</a></li>
          <li class="inherited"><a href="../../media/MediaSource/descriptionLocalisation.html">descriptionLocalisation</a></li>
          <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/hashCode.html">hashCode</a></li>
          <li class="inherited"><a href="../../media/MediaSource/icon.html">icon</a></li>
          <li class="inherited"><a href="../../media/MediaSource/implementsHistory.html">implementsHistory</a></li>
          <li class="inherited"><a href="../../media/MediaSource/implementsSearch.html">implementsSearch</a></li>
          <li><a href="../../media/PlayerLocalMediaSource/isProcessingEmbeddedSubtitles.html">isProcessingEmbeddedSubtitles</a></li>
          <li class="inherited"><a href="../../media/MediaSource/mediaType.html">mediaType</a></li>
          <li class="inherited"><a href="../../media/MediaSource/overridesAutoAudio.html">overridesAutoAudio</a></li>
          <li class="inherited"><a href="../../media/MediaSource/overridesAutoImage.html">overridesAutoImage</a></li>
          <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html">runtimeType</a></li>
          <li class="inherited"><a href="../../media/MediaSource/shouldGenerateAudio.html">shouldGenerateAudio</a></li>
          <li class="inherited"><a href="../../media/MediaSource/shouldGenerateImage.html">shouldGenerateImage</a></li>
          <li class="inherited"><a href="../../media/MediaSource/sourceName.html">sourceName</a></li>
          <li class="inherited"><a href="../../media/MediaSource/sourceNameLocalisatiton.html">sourceNameLocalisatiton</a></li>
          <li class="inherited"><a href="../../media/MediaSource/uniqueKey.html">uniqueKey</a></li>

        <li class="section-title"><a href="../../media/PlayerLocalMediaSource-class.html#instance-methods">Methods</a></li>
          <li class="inherited"><a href="../../media/MediaSource/buildBar.html">buildBar</a></li>
          <li class="inherited"><a href="../../media/PlayerMediaSource/buildHistoryPage.html">buildHistoryPage</a></li>
          <li><a href="../../media/PlayerLocalMediaSource/buildLaunchPage.html">buildLaunchPage</a></li>
          <li><a href="../../media/PlayerLocalMediaSource/buildPickVideoButton.html">buildPickVideoButton</a></li>
          <li class="inherited"><a href="../../media/PlayerMediaSource/buildSettingsButton.html">buildSettingsButton</a></li>
          <li class="inherited"><a href="../../media/MediaSource/clearCurrentSentence.html">clearCurrentSentence</a></li>
          <li class="inherited"><a href="../../media/MediaSource/clearExtraData.html">clearExtraData</a></li>
          <li class="inherited"><a href="../../media/MediaSource/clearOverrideValues.html">clearOverrideValues</a></li>
          <li class="inherited"><a href="../../media/PlayerMediaSource/clearTranscriptSubtitle.html">clearTranscriptSubtitle</a></li>
          <li class="inherited"><a href="../../media/MediaSource/deletePreference.html">deletePreference</a></li>
          <li class="inherited"><a href="../../media/PlayerMediaSource/generateAudio.html">generateAudio</a></li>
          <li class="inherited"><a href="../../media/PlayerMediaSource/generateImages.html">generateImages</a></li>
          <li class="inherited"><a href="../../media/MediaSource/generateSearchSuggestions.html">generateSearchSuggestions</a></li>
          <li><a href="../../media/PlayerLocalMediaSource/generateThumbnail.html">generateThumbnail</a></li>
          <li><a href="../../media/PlayerLocalMediaSource/getActions.html">getActions</a></li>
          <li><a href="../../media/PlayerLocalMediaSource/getDisplaySubtitleFromMediaItem.html">getDisplaySubtitleFromMediaItem</a></li>
          <li class="inherited"><a href="../../media/MediaSource/getDisplayThumbnailFromMediaItem.html">getDisplayThumbnailFromMediaItem</a></li>
          <li class="inherited"><a href="../../media/MediaSource/getDisplayTitleFromMediaItem.html">getDisplayTitleFromMediaItem</a></li>
          <li class="inherited"><a href="../../media/MediaSource/getLocalisedDescription.html">getLocalisedDescription</a></li>
          <li class="inherited"><a href="../../media/MediaSource/getLocalisedSourceName.html">getLocalisedSourceName</a></li>
          <li class="inherited"><a href="../../media/MediaSource/getOverrideThumbnailFilename.html">getOverrideThumbnailFilename</a></li>
          <li class="inherited"><a href="../../media/MediaSource/getOverrideThumbnailFromMediaItem.html">getOverrideThumbnailFromMediaItem</a></li>
          <li class="inherited"><a href="../../media/MediaSource/getOverrideTitleFromMediaItem.html">getOverrideTitleFromMediaItem</a></li>
          <li class="inherited"><a href="../../media/MediaSource/getOverrideTitleKey.html">getOverrideTitleKey</a></li>
          <li class="inherited"><a href="../../media/MediaSource/getPreference.html">getPreference</a></li>
          <li class="inherited"><a href="../../media/MediaSource/getThumbnailUri.html">getThumbnailUri</a></li>
          <li class="inherited"><a href="../../media/MediaSource/initialise.html">initialise</a></li>
          <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
          <li class="inherited"><a href="../../media/MediaSource/onMediaItemClear.html">onMediaItemClear</a></li>
          <li><a href="../../media/PlayerLocalMediaSource/onSearchBarTap.html">onSearchBarTap</a></li>
          <li class="inherited"><a href="../../media/PlayerMediaSource/onSourceExit.html">onSourceExit</a></li>
          <li><a href="../../media/PlayerLocalMediaSource/pickVideoFile.html">pickVideoFile</a></li>
          <li class="inherited"><a href="../../media/PlayerMediaSource/prepareMediaResources.html">prepareMediaResources</a></li>
          <li><a href="../../media/PlayerLocalMediaSource/preparePlayerController.html">preparePlayerController</a></li>
          <li class="inherited"><a href="../../media/MediaSource/prepareResources.html">prepareResources</a></li>
          <li><a href="../../media/PlayerLocalMediaSource/prepareSubtitles.html">prepareSubtitles</a></li>
          <li class="inherited"><a href="../../media/MediaSource/searchMediaItems.html">searchMediaItems</a></li>
          <li class="inherited"><a href="../../media/MediaSource/setCurrentSentence.html">setCurrentSentence</a></li>
          <li class="inherited"><a href="../../media/MediaSource/setExtraData.html">setExtraData</a></li>
          <li class="inherited"><a href="../../media/MediaSource/setOverrideThumbnailFromMediaItem.html">setOverrideThumbnailFromMediaItem</a></li>
          <li class="inherited"><a href="../../media/MediaSource/setOverrideTitleFromMediaItem.html">setOverrideTitleFromMediaItem</a></li>
          <li class="inherited"><a href="../../media/MediaSource/setPreference.html">setPreference</a></li>
          <li class="inherited"><a href="../../media/MediaSource/setShouldGenerateAudio.html">setShouldGenerateAudio</a></li>
          <li class="inherited"><a href="../../media/MediaSource/setShouldGenerateImage.html">setShouldGenerateImage</a></li>
          <li class="inherited"><a href="../../media/PlayerMediaSource/setTranscriptSubtitle.html">setTranscriptSubtitle</a></li>
          <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/toString.html">toString</a></li>

        <li class="section-title inherited"><a href="../../media/PlayerLocalMediaSource-class.html#operators">Operators</a></li>
          <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html">operator ==</a></li>


        <li class="section-title"><a href="../../media/PlayerLocalMediaSource-class.html#static-properties">Static properties</a></li>
          <li><a href="../../media/PlayerLocalMediaSource/instance.html">instance</a></li>


</ol>

  </div><!--/.sidebar-offcanvas-->

  <div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right">
  </div><!--/.sidebar-offcanvas-->

</main>

<footer>
  <span class="no-break">
    yuuna
      2.8.0+93
  </span>

  
</footer>



<script src="../../static-assets/highlight.pack.js?v1"></script>
<script src="../../static-assets/docs.dart.js"></script>



</body>

</html>

